/* BEGIN_COPYRIGHT                                                        */
/*                                                                        */
/* OpenDiameter: Open-source software for the Diameter protocol           */
/*                                                                        */
/* Copyright (C) 2007 Open Diameter Project 				  */
/*                                                                        */
/* This library is free software; you can redistribute it and/or modify   */
/* it under the terms of the GNU Lesser General Public License as         */
/* published by the Free Software Foundation; either version 2.1 of the   */
/* License, or (at your option) any later version.                        */
/*                                                                        */
/* This library is distributed in the hope that it will be useful,        */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of         */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      */
/* Lesser General Public License for more details.                        */
/*                                                                        */
/* You should have received a copy of the GNU Lesser General Public       */
/* License along with this library; if not, write to the Free Software    */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307    */
/* USA.                                                                   */
/*                                                                        */
/* In addition, when you copy and redistribute some or the entire part of */
/* the source code of this software with or without modification, you     */
/* MUST include this copyright notice in each copy.                       */
/*                                                                        */
/* If you make any changes that are appeared to be useful, please send    */
/* sources that include the changed part to                               */
/* diameter-developers@lists.sourceforge.net so that we can reflect your  */
/* changes to one unified version of this software.                       */
/*                                                                        */
/* END_COPYRIGHT                                                          */
/* 
   xyz_ha_server_session.hxx
   Specific/Xyz MIP Home Agent server session implementation, 
   exposing the interface required by libdiamtermip4
   Written by Miriam Tauil
   Created January 5, 2005.
*/

#ifndef __XYZ_HA_SERVER_SESSION_H__
#define __XYZ_HA_SERVER_SESSION_H__
#include <unistd.h>
#include "diameter_parser.h"
#include "diameter_mip4_parser.hxx"

#include "diameter_mip4_ha_server_interface.hxx"

/*************************************************************************
  The DiameterMip4HaServer class specifies an interface for a MIP Home Agent
  Server implementation.
  Once the Home Agent server implementation is implemented with the following 
  interface, the Diameter MIP HA Server sample application, will provide a 
  HA server session implementation supporting the Diameter MIP Application.

 **************************************************************************/


class XyzHaServerSession : public DiameterMip4HaServer {

   public:

      // harData content is necessary for this object to operate
      // it is not passed on the constructor, since it will be created
      // by the AAAServerSessionFactoryClass, and the factory class
      // will create new sessions when an HAR arrives, which will cause
      // the call of the HAR_Handler in DiameterMip4HaServerSession,
      // which will call SetharData (HAR_Data &harData)

  XyzHaServerSession():DiameterMip4HaServer(){}
        
      virtual ~XyzHaServerSession(){}

      //  function to process reg request 

      // return 1 -  mip reg request accepted
      // return 2 -  mip reg request rejected
      // return 3 -  invalid mip reg request 
      // else error ... return values might be added/changed as needed
      int ProcessMipRegRequest( diameter_octetstring_t & MipRegReq )
      {
	return 1;
      }


      /** The following functions will set the passed variable to contain 
         the value set by the Home Agent, if the value cannot be set 
	       return 0,
	       otherwise return 1
      **/

      // called if FA-Ha-Key-Requested: generated by HA
      int SetMipFaToHaSpi(diameter_unsigned32_t &faHaSpi)
      {
	faHaSpi = 1;
	return 1;
      }
 
      // called if MN-FA-Key-Requested: HA extract value from MipRegRequest
      int SetMipFaToMnSpi(diameter_unsigned32_t &faMnSpi)
      {
	faMnSpi= 2;
	return 1;
      }

      int SetMipRegReply(diameter_octetstring_t &reply)
      {
	reply = "XFDEJCRP:EOJFGP:$REKNVCK$ERNC:K$NR<CN:$REKK$RJH";
	return 1;
      }

      // is called if MN address does not appear in HAR
      int SetMipMnAddress(diameter_address_t &address)
      {
	address.type = AAA_ADDR_FAMILY_IPV4;
	address.value = "192.4.8.12";
	return 1;
      }

     // Must be populated by HA
      int SetAcctMultiSessionId( diameter_utf8string_t &acctMultiSessionId)
      {
	acctMultiSessionId = "has.homedomain.com;1876543210;523";
	return 1;
      }


  /* this fn will be call to release local resource allocated to a session
     will be called in the session fn: HandleAbort(), 
     HandleAuthGracePeriodTimeout(), HandleDisconnect, HandleSessiontimeout()
     STR received (where this is captured??)
  */
  void ReleaseSessionResources(){}

  
};
 
#endif  // __XYZ_HA_SERVER_SESSION_H__
 
 
